package com.ljx.recruitment.user.controller;

import com.ljx.recruitment.common.domain.vo.resp.ApiResult;
import com.ljx.recruitment.security.annotation.ApiPermission;
import com.ljx.recruitment.security.common.PermissionConstant;
import com.ljx.recruitment.user.domain.vo.resp.AdminOptionsResp;
import com.ljx.recruitment.user.domain.vo.resp.HomeOptionResp;
import com.ljx.recruitment.user.domain.vo.resp.UserOptionsResp;
import com.ljx.recruitment.user.service.OptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-11-01  21:26
 */
@Api(tags = "选项接口")
@RestController
@RequestMapping("/option")
public class OptionController {

    @Autowired
    private OptionService optionService;

    @ApiPermission(permissions = {PermissionConstant.ADMIN_OPTION_QUERY})
    @ApiOperation("获取后台管理菜单的选项")
    @GetMapping("/admin")
    public ApiResult<AdminOptionsResp> getAdminOpts(){
        return ApiResult.success(optionService.getAdminOpts());
    }

    @ApiPermission(permissions = {PermissionConstant.USER_QUERY})
    @ApiOperation("获取用户菜单的选项")
    @GetMapping("/user")
    public ApiResult<UserOptionsResp> getUserOpts(){
        return ApiResult.success(optionService.getUserOpts());
    }

    @ApiPermission(permissions = {PermissionConstant.USER_QUERY})
    @ApiOperation("获取主页菜单的选项")
    @GetMapping("/home")
    public ApiResult<HomeOptionResp> getHomeOpts(){
        return ApiResult.success(optionService.getHomeOpts());
    }

}
